package com.example.shopdemo.enums;

/**
 * @author ：Anitaxiaofeng
 * @description：
 * @create 2018-02-04
 **/
public enum  WechatAuthStateEnum {
    LOGINFAIL(-1, "openId输入有误"), SUCCESS(0, "操作成功"), NULL_AUTH_INFO(-1006,
            "注册信息为空");

    private int key;

    private String value;

    private WechatAuthStateEnum(int key, String value) {
        this.key = key;
        this.value = value;
    }

    public int getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    public static WechatAuthStateEnum stateOf(int index) {
        for (WechatAuthStateEnum state : values()) {
            if (state.getKey() == index) {
                return state;
            }
        }
        return null;
    }
}
